package goldeneagle.com.user.service;

import goldeneagle.com.entity.User;
import goldeneagle.com.user.dao.UserDaoImpl;

/*
 *Created by GHW
 *Description:Service层，操作实现类，实现业务逻辑
 *2019/11/12 17:07
 */
public class UserService {
    private UserDaoImpl userDao = new UserDaoImpl();

    //根据用户名查找用户,判断密码是否一致，用户类型是否一致
    public User FindUserByUsername(String username){
        //调用方法，查找用户是否存在
           User user = userDao.FindUserByUsername(username);
        //判断密码和用户类型是否一致
        return user;
    }

    //用户注册
    public User UserRegister(User user){
        //调用方法，添加用户
        user = userDao.UserRegister(user);
        System.out.println(user);
        return user;
    }

    //用户个人信息修改
    public void UpdateUserInfo(User user){
        UserDaoImpl userDao = new UserDaoImpl();
        if(user!=null){
            userDao.UpdateUserInfo(user);
        }else{
            System.out.println("user为空");
        }
    }
}
